gtkdialog - more informative warning when ordering unexisting response_id
authorJehan <jehan@girinstud.io>
Wed, 17 Jul 2013 10:05:21 +0000 (19:05 +0900)
committerJehan <jehan@girinstud.io>
Sun, 21 Jul 2013 12:42:50 +0000 (21:42 +0900)
gtk/gtkdialog.c

index 789c573f8fd62d7b63fea5241f61a7e4e6049c8a..10a5a5a1319b15591af8fa0b7c1bb999a1486b3a 100644 (file)
@@ -1219,7 +1219,11 @@ gtk_dialog_set_alternative_button_order_valist (GtkDialog *dialog,
     {
       /* reorder child with response_id to position */
       child = dialog_find_button (dialog, response_id);
-      gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
+      if (child != NULL)
+        gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
+      else
+        g_warning ("%s : no child button with response id %d.", G_STRFUNC,
+                   response_id);
 
       response_id = va_arg (args, gint);
       position++;
@@ -1330,7 +1334,11 @@ gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
   {
       /* reorder child with response_id to position */
       child = dialog_find_button (dialog, new_order[position]);
-      gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
+      if (child != NULL)
+        gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
+      else
+        g_warning ("%s : no child button with response id %d.", G_STRFUNC,
+                   new_order[position]);
     }
 }